package com.bd08.flink.demo

import com.bd08.flink.demo.WindowTWordCount.{WordCount, ds, env}
import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment, createTypeInformation}
import org.apache.flink.streaming.api.windowing.assigners.TumblingProcessingTimeWindows
import org.apache.flink.streaming.api.windowing.time.Time

object TestMyRandomSource  extends App {
  case class Data(data:Int)
  val env = StreamExecutionEnvironment.getExecutionEnvironment
  val ds:DataStream[Int] = env.addSource(new MyRandomSource)

    ds
      .map(data => Data(data))
      .keyBy(data => "nums")
      .countWindow(5).sum("data")
    //.window(TumblingProcessingTimeWindows.of(Time.seconds(30))).sum(1)
      .print()
  env.execute("window-t-sum")

}
